package com.gui.design.factory.factoryMethod;

import com.gui.design.factory.factoryMethod.factory.BaoXueGameFactory;
import com.gui.design.factory.factoryMethod.factory.GameFactory;
import com.gui.design.factory.factoryMethod.factory.MiHaYouGameFactory;
import com.gui.design.factory.factoryMethod.factory.TxGameFactory;
import com.gui.design.factory.factoryMethod.game.Game;


public class GameClient {

    private GameFactory factory;

    public GameClient(GameFactory gameFactory) {
        this.factory = gameFactory;
    }

    public void playGame(){
        Game game = this.factory.getGame();
        game.start();
        game.play();
        game.exit();
    }


    public static void main(String[] args) {
        GameClient miHaYouClient = new GameClient(new MiHaYouGameFactory());
        miHaYouClient.playGame();

        GameClient txClient = new GameClient(new TxGameFactory());
        txClient.playGame();

        GameClient bxClient = new GameClient(new BaoXueGameFactory());
        bxClient.playGame();

    }
}
